<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="10" />

    <title>{$storeData.local_name}-怡臣优选</title>
    <link rel="stylesheet" href="__PUBLIC__/Home/css/swiper.min.css">
    <link rel="stylesheet" href="__PUBLIC__/Home/css/home.css?v=20170515001">
    <script type="text/javascript">
		//是否直接头部使用自动配置
    	var yc_wx_useInHeader = false;
		//是否使用自动定位
		var yc_wx_location = false;
    </script>
    <include file="Public/common_js"/>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={$ak}"></script>
</head>
<body>
    <div class="warp" style="padding-bottom:1.1rem;">
        <!-- 门店选择 -->
        <div class="shop-entry">
            <div class="shop-current">
                <a href="{:url('First/stortSelect')}" class="location-icon"></a>
                <a href="{:url('First/stortSelect')}" class="shop h3">{$storeData.local_name}</a>
            </div>
        </div>
        <!-- 搜索 -->
        <div class="fixed-search"><a href="{:url('Search/index')}"></a></div>
        <div style="height: 0.82rem;"></div>

        <div class="swiper-container">
            <!--轮播-->
            <div class="swiper-wrapper">
                <foreach name="carousel" item="v" >
                    <if condition="$v['type'] == '图链接'">
                        <div class="swiper-slide"><a href="{$v.url}"><img src="/Uploads/{$v['img']}"></a></div>
                        <elseif condition="$v['type'] == '产品详情'" />
                        <div class="swiper-slide"><a href="{:url('goods/detail',['id'=>$v[value], 'local_id' =>$storeData['local_id']])}"><img src="/Uploads/{$v['img']}"></a></div>
                        <elseif condition="$v['type'] == '产品列表'" />
                        <div class="swiper-slide"><a href="/home/store/goods_list/id/{$v['id']}/type/carousel/local_id/{$storeData.local_id}"><img src="/Uploads/{$v['img']}"></a></div>
                        <elseif condition="$v['type'] == '文章列表'" />
                        <div class="swiper-slide"><a href="{$v.url}"><img src="/Uploads/{$v['img']}"></a></div>
                    </if>
                </foreach>
            </div>
            <!-- Add Pagination -->
            <div class="swiper-pagination"></div>
        </div>

        <!-- 门店加粉丝关注-->
        <?php if ($storeData['is_self'] != 1){ ?>
        <div class="shop-attention">
            <div class="shop-attention-name">
                <h3>{$storeData.local_name}</h3>
                <span><font>{$member_like_store}</font>粉丝</span>
            </div>
            <a class="weixin-attention <if condition='$member_store_data eq false '> active </if>" data-localId="{$storeData['local_id']}">关注</a>
        </div>
        <?php } ?>
        <?php //dump(session('t_userInfo'));?>
        <!-- 主菜单 -->
        <div class="main-nav clearfix mgTop">
            <foreach name="shortcutMsg" item="v" >

                <if condition="$v['type'] == '图链接'">
                    <if condition="strpos($v[url],'http') === false">
                        <a href="<?php echo url($v['url'])?>">
                            <span><img style="" class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/{$v['img']}"></span>
                            <p>{$v.name}</p>
                        </a>
                        <else />
                        <a href="{$v.url}">
                            <span><img style="" class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/{$v['img']}"></span>
                            <p>{$v.name}</p>
                        </a>
                    </if>

                    <elseif condition="$v['type'] == '产品详情'" />
                    <a href="{:url('goods/detail',['id'=>$v[value], 'local_id' => $storeData['local_id']])}">
                        <span><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/{$v['img']}"></span>
                        <p>{$v.name}</p>
                    </a>
                    <elseif condition="$v['type'] == '产品列表'" />
                    <a href="{:url('store/goods_list',['id'=>$v[id], 'local_id' => $storeData['local_id']])}">
                        <span><img  class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/{$v['img']}"></span>
                        <p>{$v.name}</p>
                    </a>
                </if>

            </foreach>
        </div>
        <!--广告模块-->

        <notempty name="advertId">
            <div class="activity">
                <a href="{$advertUrl}"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/{$advertImage}" alt=""></a>
            </div>

        </notempty>





        <!-- 活动板块 -->
        <foreach name="specialMsg" item="v" >
        <div class="activity mgTop">
            <a href="{:url('Store/viewTemplate', array('id'=>$v['id'], 'local_id' => $storeData['local_id']),'')}"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="/Uploads/{$v['img_url']}" alt=""></a>
            <h2 class="pdLR"><p><span class="red">{$v.price_desc}</span><span>{$v.title}</span></p><p class="gray">仅剩{$v.end_time}天</p></h2>
        </div>
        </foreach>
        <!-- 促销板块 -->
        <div class="promotion-goods mgTop">
            <div class="goods-horizontal">

                <foreach name="maShangMaiMsg" item="v" >
                <div class="goods-item clearfix">
                    <a href="{:url('Goods/detail', array('id'=>$v['store_pid'], 'local_id' => $storeData['local_id']),'')}" class="img <?php echo ($v['store']-$v['freez']) <=0 ? 'img sold_out' : ''; ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$v.goods_id|getThumb=###}"></a>
                    <div class="text">
                        <a href="{:url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']])}" class="goods-name">{$v.name}</a>
                        <p class="goods-norms">
                            {$v.spec_info}                            
                        </p>
                        <p class="gmarks">
                        	<if condition="!empty($v['proPrice']) and ($v['proPrice'] neq $v['price'])"><i>促销</i></if>
                            <if condition="!empty($v['flashGoods'])"><i>闪购</i></if>
                            <if condition="$v['groupPromotion'] eq true"><i>套餐</i></if>
                        </p>
                        <if condition="!empty($v['proPrice']) and ($v['proPrice'] neq $v['price'])">
                            <p class="sale-price">￥{$v.proPrice}</p>
                            <p class="old-price">￥{$v.price}</p>
                        <else/>
                            <if condition="!empty($v['flashGoods'])">
                                <p class="sale-price"><span>￥{$v['flashGoods']['promotion_price']|number_format=###, 2, '.', ''}</span></p>
                                <else/>
                                <p class="sale-price"><span>￥{$v['price']}</span></p>
                            </if>
                        </if>
                        <a href="{:url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']])}" class="btn-buy">马上买</a>
                    </div>
                </div>
                </foreach>
            </div>
        </div>
        <!-- 推荐商品 -->
        <div class="recommand-box mgTop">
            <div class="title_01"><span>推荐</span></div>
            <div class="recommand-list">

                <foreach name="tuiJianMsg" item="v" >
                <div class="goods-item">
                    <a href="{:url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']])}" class="img"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$v.goods_id|getThumb=###}"></a>
                    <a href="{:url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']])}" class="name text-hide"><if condition="!empty($v['proPrice']) and ($v['proPrice'] neq $v['price'])"><i class="o-mark">促销</i></if><if condition="!empty($v['flashGoods'])"><i class="o-mark">闪购</i></if><if condition="$v['groupPromotion'] eq true"><i class="o-mark">套餐</i></if>{$v.name}</a>
                    <p href="{:url('goods/detail',['id'=>$v[store_pid], 'local_id' => $storeData['local_id']])}" class="des text-hide">
                        {$v.spec_info}                        
                    </p>
                    <if condition="!empty($v['proPrice']) and ($v['proPrice'] neq $v['price'])">
                        <p class="price">
                            <span>￥{$v['proPrice']}</span>
                            <label>￥{$v['price']}</label>
                        </p>
                    <else/>
                        <if condition="!empty($v['flashGoods'])">
                                <p class="price"><span>￥{$v['flashGoods']['promotion_price']|number_format=###, 2, '.', ''}</span></p>
                            <else/>
                                <p class="price"><span>￥{$v['price']}</span></p>
                        </if>
                    </if>
                </div>
                </foreach>
            </div>
        </div>
    </div>
    <input type="hidden" id="stortSelect" value="{$stortSelect}">
    <!-- 网站主菜单 -->
    <include file="Public/menu"/>
    <include file="Public/footer_js"/>
    <script src="__PUBLIC__/Home/js/main.js?v=201703010001"></script>
    <script type="text/javascript">

        var source = "{$source}";//已选择
        var self_store = "{$is_self}";//1-为全国送
        var yc_data_province = "{$storeData[province]}";
        var yc_data_city = "{$storeData[city]}";
        var yc_data_area = "{$storeData[area]}";
        var yc_data_url = "{:url('First/stortSelect')}";
		function mapCallback(lat, lng){
			BMapGetLocation(lng, lat);
		}
		function saveUserOperation(){
			var timestamp = Date.parse(new Date());								
			timestamp = timestamp / 1000;
			_global.cacher.set("time", timestamp);
			_global.cacher.set("stortSelect", 1); 
		}
		function BMapGetLocation(lng, lat){
			var pt = new BMap.Point(lng, lat);
			var gc = new BMap.Geocoder();
			var addComp;
			//获取地址的数据地址
			gc.getLocation(pt, function (rs) {
				addComp = rs.addressComponents;
				var province = addComp.province;
				var city     = addComp.city;
				var district     = addComp.district;
				if(province != yc_data_province || city != yc_data_city || district != yc_data_area){
					saveUserOperation();
					if (confirm("你目前的位置已经不在{$storeData[local_name]}范围内了，是否切换附近门店？")) {
						window.location.href = yc_data_url;
					}
				}
			});
		}		
		if(_global.isWeiXinLoad){
			yc_wx_options["refuseCallback"] = saveUserOperation;
			yc_wx_options["mapCallback"] = mapCallback;
		}
        function exeBaiduMap(){
            //读本地存储（取消切换店铺的值）
            var timelop;
            var stortSelect;
            var _timestamp = Date.parse(new Date());
            _timestamp = _timestamp / 1000;
			timelop = _global.cacher.get('time');
			stortSelect = _global.cacher.get('stortSelect');
            //是否有本地存储
            if(timelop && stortSelect){
                //时间超过一天清空本地存储
                if((_timestamp - timelop) > 86400){
					_global.cacher.remove("time");
					_global.cacher.remove("stortSelect");
                    stortSelect = 0;
                }else{
					return;	
				}
            }else{
                stortSelect = 0;
            }
            if(source == 1 && stortSelect != 1 && self_store != 1) {
                yc_wx_options["enableLocation"] = true;
            }
			wxAutoConfig(yc_wx_options);
        }
		exeBaiduMap();
   </script>
</body>
</html>
